<li style="display: none;" id="notice_<?php echo $noticeId ?>">
<?php
	if(isset($noticeId)){
		
		//thumb and user
                $authorThumb = $this->Html->tag('span', $this->Html->image($avatar, array('url' => '/'.$this->Bayon->username())), array( 'class' => 'author-thumb'));
                $user = $this->Html->tag('span', $this->Html->link($this->Bayon->username(), '/'.$this->Bayon->username()), array('class' => 'author-username'));

		//display notice
                $message = $this->Html->div('message', $render);

                $favorLink = $this->Html->link(__('Favor', true), '#', array('id' => 'favor-link-'.$noticeId));
		$favorLink = sprintf('<span class="ui-icon ui-icon-heart"></span> %s', $favorLink);
                $favor = $this->Html->tag('li',$favorLink ,array('id' => 'favor_'.$noticeId));
		
                $removeLink = $this->Html->link(__('Remove', true), '#', array('id' => 'remove-link-'.$noticeId));
                $remove = sprintf('<li><span class="ui-icon ui-icon-close"></span>%s</li>', $removeLink);

                //setup action
                $actions = $this->Html->tag('ul' , $favor. $remove,  array('class' => 'actions actions-hidden clearfix', 'id' => 'ul_notice_'.$noticeId));
                $actions = $this->Html->div('actions-wrap', $actions );

                //wrap all
                $noticeWrap = $this->Html->div('message-notice', $user . $message . $actions);
                //display notice
		echo $this->Html->tag('li',  sprintf('%s %s', $authorThumb, $noticeWrap) , array('id' => 'notice_'.$noticeId, 'class' => 'notice clearfix'));
		
		
	}

?>
</li>
<script type="text/javascript">
//<![CDATA[
     $(document).ready(function(){
                $("ul > li.notice").bind('mouseover', function(){
                    var actionId ='#ul_' + $(this).attr('id');
                    $(actionId).addClass('actions-active');
                });
                $("ul > li.notice").bind('mouseout', function(){
                    var actionId ='#ul_' + $(this).attr('id');
                    $(actionId).removeClass('actions-active');
                });

         });
    //]]>
$("#<?php echo 'favor-link-'.$noticeId;?>").bind("click", function (event) {
	$.ajax({
		data:"data[Favor][notice_id]=<?php echo $noticeId ?>", 
		dataType:"html", 
		error:function (
			XMLHttpRequest, 
			textStatus, 
			errorThrown) {
			alert(errorThrown)
			}, 
		success:function (data, textStatus) {
			favor(data, <?php echo $noticeId ?>)
			}, 
		type:"POST", 
		url:"\/bayon\/favors\/add"
		}
	); 
	return false;});

	//remove script
$("#<?php echo 'remove-link-'.$noticeId;?>").bind("click", function (event) {
	$.ajax({
		data:"data[Remove][notice_id]=<?php echo $noticeId ?>", 
		dataType:"json", 
		error:function (XMLHttpRequest, textStatus, errorThrown) {
			alert("error")
		}, 
		success:function (data, textStatus) {
			removeNotice(data)
		}, 
		type:"POST", 
		url:"\/bayon\/notices\/remove"});
	return false;
});
</script>